package mviewer.renderer.jogl;

import com.jogamp.opengl.util.texture.Texture;
import java.util.Map;
import javax.media.opengl.GL2;
import mviewer.renderer.jogl.drawer.ColoredPolygonDrawer;
import mviewer.renderer.jogl.drawer.FixedTextureCoordinateDrawer;
import mviewer.renderer.jogl.drawer.GeneratedTextureCoordinateDrawer;
import mviewer.types.IDrawer;
import mviewer.types.IDrawerContext;
import mviewer.types.Material;

public class DrawerContext implements IDrawerContext {

	private IDrawer[] drawer;

	public DrawerContext(GL2 gl, Map<Material, Texture> textures) {
		drawer = new IDrawer[] {new ColoredPolygonDrawer(gl),
								new FixedTextureCoordinateDrawer(gl, textures),
								new GeneratedTextureCoordinateDrawer(gl, textures)};
	}

	@Override
	public IDrawer getDrawer(int feature) {
		return drawer[feature];
	}
}
